package com.zle.common.redis;

import redis.clients.jedis.Jedis;
import redis.clients.jedis.JedisPool;

public class RedisClient {
	private JedisPool jdisPool;
	
	private RedisClient(String ip ,int port){
		jdisPool = new JedisPool(ip,port);
		
		
	}
	public String putvalue(String val){
		String key = "modul:name";
		Jedis jedis = jdisPool.getResource();
		String result = jedis.setex(key, 2000, val);
		jedis.close();
		return result;
	}
	public String getvalue(){
		String key = "modul:name";
		Jedis jedis = jdisPool.getResource();
		String result = jedis.get(key);
		jedis.close();
		return result;
	}
	public static void main(String[] args) {
		RedisClient cli = new RedisClient("192.168.1.117",6379);
		System.out.println(cli.putvalue("24234"));
		System.out.println(cli.getvalue());
	}
}
